﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../scripts/boot.js" type="text/javascript"></script>
    <script type="text/javascript">
        $.ajax({
            url: "../data/system.aspx?method=103",
            async: false,
            success: function (text) {
                if (text == "no")
                    window.location = "../system/error.html";
                else if (text == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                    var tabs = parent.mini.get("mainTabs");
                    var tab = tabs.getTab("tab$103");
                    tabs.removeTab(tab);
                }
            }
        });
        var State = [{ id: 0, text: '未审核' }, { id: 1, text: '已审通过' }, { id: 2, text: '已审未通过' }, { id: -1, text: "全部"}];
    </script>
</head>
<body>
    <div class="mini-toolbar" style="border-bottom: 0;">
        <table>
            <tr>
                <td>
                    单位:
                    <input class="mini-textbox" id="key" style="width:150px" emptytext="用户名或企业名称关键字"/>
                    类型:
                    <input id="state" name="state" class="mini-combobox" data="State" value="0" style="width: 100px" />
                    <a class="mini-button" iconcls="icon-search" plain="true" onclick="search()">查询</a>
                    <span class="separator"></span>
                    <div class="mini-checkbox" text="全选" onvaluechanged="onValueChanged"></div>
                    <a class="mini-button" plain="true" iconcls="icon-ok" onclick="checkRows(1)">审核通过</a>
                    <a class="mini-button" plain="true" iconcls="icon-no" onclick="checkRows(2)">审核不通过</a>
                    <a class="mini-button" plain="true" iconcls="icon-remove" onclick="delRows()">删除</a>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit">
        <table class="mini-fit" cellspacing="0" cellpadding="0" style="border:solid 1px #ccc;border-top: 0;">
            <tr>
                <td id="pic_td">
                    <div style="width: 160px; height: 65px; float: left; border: 1px solid #ddd; margin: 3px;">
                        <div style="width: 150px; height: 35px; margin-left: 5px; margin-top: 5px;">
                            <a href="../../html/company.php?id=29180" target="_blank">
                                <img src="../../upfile/company/1316682224.jpg" width="150" height="35" border="0"></a>
                        </div>
                        <div style="width: 150px; height: 20px; margin-left: 5px; margin-top: 5px; line-height: 20px;">
                            <input class="mini-checkbox-check" type="checkbox" name="chk_list" value="29180" /><a target="_blank" class="linelink"
                                href="../../html/resume.php?id=235409">湖州宝晨汽车销售服务有限公司</a>( <font color="#222222">未审核</font> )
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-pager" id="page" style="background: #f0f3f7; border: solid 1px #ccc;"
        totalcount="0" onpagechanged="onPageChanged" sizeList="[15,20,50,100]" pageSize="20"
        showPageSize="true" showPageIndex="true" showPageInfo="true">
    </div>
    <script type="text/javascript">
        $.ajaxSetup({
            contentType: "application/x-www-form-urlencoded;charset=utf-8",
            complete: function (XMLHttpRequest, textStatus) {
                if (XMLHttpRequest.responseText == "out") {
                    var loginWindow = parent.mini.get("loginWindow");
                    if (!loginWindow.visible)
                        loginWindow.show();
                }
            }
        });

        mini.parse();

        search();

        //查询
        function search() {
            var state = mini.get("state").getValue();
            var key = mini.get("key").getValue();
            var page = mini.get("page");
            DataLoad(page.pageIndex, page.pageSize, state, key);
        }

        //数据绑定
        function DataLoad(pageIndex, pageSize, state, key) {
            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: 'Loading...' });
            $("#pic_td").empty();
            $(".mini-checkbox-check").attr("checked", false);
            $.ajax({
                url: "../data/system.aspx?method=GetComPictureList",
                data: { sortField: 'cu_no', sortOrder: 'desc', pageIndex: pageIndex, pageSize: pageSize, state: state, key: key },
                success: function (text) {
                    mini.unmask(document.body);
                    if (text == "out") {
                        var loginWindow = parent.mini.get("loginWindow");
                        if (!loginWindow.visible)
                            loginWindow.show();
                        return;
                    }
                    var o = mini.decode(text);
                    $.each(o.data, function (i, item) {
                        var html = '<div style="width: 160px; height: 65px; float: left; border: 1px solid #ddd; margin: 3px;">';
                        html += '<div style="width: 150px; height: 35px; margin-left: 5px; margin-top: 5px;">';
                        html += '<a target="_blank" href="' + item.cu_logo + '"><img width="150" height="35" border="0" src="' + item.cu_logo + '"/></a></div>';
                        html += '<div style="width: 150px; height: 20px; margin-left: 5px; margin-top: 5px; overflow:hidden; line-height: 20px;">';
                        html += '<input class="mini-checkbox-check" type="checkbox" name="chk_list" value="' + item.cu_no + '"/>';
//                        if (item.cu_logostate == 1)
                        //                            html += '<a target="_blank" class="linelinkgreen" href="../../Web/Company/' + item.cu_no + '.html" title="' + item.cu_name + '&#13&#13已审通过">' + item.cu_name + '</a></div></div>';
//                        else if (item.cu_logostate == 2)
                        //                            html += '<a target="_blank" class="linelinkred" href="../../Web/Company/' + item.cu_no + '.html" title="' + item.cu_name + '&#13&#13已审未通过">' + item.cu_name + '</a></div></div>';
//                        else
                        //                            html += '<a target="_blank" class="linelinkblack" href="../../Web/Company/' + item.cu_no + '.html" title="' + item.cu_name + '&#13&#13未审核">' + item.cu_name + '</a></div></div>';
                        if (item.cu_logostate == 1)
                            html += '<a target="_blank" class="linelinkgreen" title="' + item.cu_name + '&#13&#13已审通过">' + item.cu_name + '</a></div></div>';
                        else if (item.cu_logostate == 2)
                            html += '<a target="_blank" class="linelinkred" title="' + item.cu_name + '&#13&#13已审未通过">' + item.cu_name + '</a></div></div>';
                        else
                            html += '<a target="_blank" class="linelinkblack" title="' + item.cu_name + '&#13&#13未审核">' + item.cu_name + '</a></div></div>';
                        $("#pic_td").append(html);
                    });
                    mini.get("page").update(pageIndex, pageSize, o.total);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    mini.unmask(document.body);
                    ShowMessage("系统提示", "页面加载出错！", 3);
                }
            });
        }

        //全选/取消
        function onValueChanged(e) {
            var checked = this.getChecked();
            $(".mini-checkbox-check").attr("checked", checked);
        }

        //翻页
        function onPageChanged(e) {
            var state = mini.get("state").getValue();
            var key = mini.get("key").getValue();
            DataLoad(e.pageIndex, e.pageSize, state, key)
        }

        //批量审核
        function checkRows(state) {
            var rows = $("input[name='chk_list']:checked");
            if (rows.length > 0) {
                mini.confirm("确定审核所选会员图片吗？", "系统提示",
                    function (action) {
                        if (action == "ok") {
                            mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '操作中，请稍后...' });
                            var ids = "";
                            for (var i = 0; i < rows.length; i++) {
                                ids += rows[i].value + ',';
                            }

                            $.ajax({
                                url: "../data/system.aspx?method=CheckComPicture",
                                type: "post",
                                data: { id: ids, state: state },
                                success: function (ret) {
                                    mini.unmask(document.body);
                                    if (ret == "out") {
                                        var loginWindow = parent.mini.get("loginWindow");
                                        if (!loginWindow.visible)
                                            loginWindow.show();
                                        return;
                                    }
                                    if (ret >= 0) {
                                        ShowMessage("系统提示", "会员图片审核成功！", 1);
                                        search();
                                    }
                                    else
                                        ShowMessage("系统提示", "会员图片审核失败！", 3);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    mini.unmask(document.body);
                                    ShowMessage("系统提示", "会员图片审核失败！", 3);
                                }
                            });
                        }
                    });
            }
            else
                ShowMessage("系统提示", "请选择需要审核的会员图片！", 2);
        }

        //批量删除
        function delRows() {
            var rows = $("input[name='chk_list']:checked");
            if (rows.length > 0) {
                mini.confirm("确定删除所选会员图片吗？", "系统提示",
                function (action) {
                    if (action == "ok") {
                        mini.mask({ el: document.body, cls: 'mini-mask-loading', html: '删除中，请稍后...' });
                        var ids = "";
                        for (var i = 0; i < rows.length; i++) {
                            ids += rows[i].value + ',';
                        }

                        $.ajax({
                            url: "../data/system.aspx?method=DeleteComPicture",
                            type: "post",
                            data: { id: ids },
                            success: function (ret) {
                                mini.unmask(document.body);
                                if (ret == "out") {
                                    var loginWindow = parent.mini.get("loginWindow");
                                    if (!loginWindow.visible)
                                        loginWindow.show();
                                    return;
                                }
                                if (ret >= 0) {
                                    ShowMessage("系统提示", "会员图片删除成功！", 1);
                                    search();
                                }
                                else
                                    ShowMessage("系统提示", "会员照片删除失败！", 3);
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                mini.unmask(document.body);
                                ShowMessage("系统提示", "会员图片删除失败！", 3);
                            }
                        });
                    }
                });
            }
            else
                ShowMessage("系统提示", "请选择需要删除的会员图片！", 2);
        }
    </script>
</body>
</html>
